@use '../../shared/styles/utils';
@use './theme';
@use './scrollbars';

:root {
	--gitlens-gutter-width: 20px;
	--gitlens-scrollbar-gutter-width: 10px;
	--gitlens-tree-foreground: var(--vscode-sideBar-foreground, var(--vscode-foreground));
}

@include utils.dark-theme() {
	--color-background--level-05: var(--color-background--lighten-05);
	--color-background--level-075: var(--color-background--lighten-075);
	--color-background--level-10: var(--color-background--lighten-10);
	--color-background--level-15: var(--color-background--lighten-15);
	--color-background--level-30: var(--color-background--lighten-30);
}

@include utils.light-theme() {
	--color-background--level-05: var(--color-background--darken-05);
	--color-background--level-075: var(--color-background--darken-075);
	--color-background--level-10: var(--color-background--darken-10);
	--color-background--level-15: var(--color-background--darken-15);
	--color-background--level-30: var(--color-background--darken-30);
}

// generic resets
html {
	font-size: 62.5%;
	// box-sizing: border-box;
	font-family: var(--font-family);
}

*,
*:before,
*:after {
	box-sizing: border-box;
}

body {
	--gk-badge-outline-color: var(--vscode-badge-foreground);
	--gk-badge-filled-background-color: var(--vscode-badge-background);
	--gk-badge-filled-color: var(--vscode-badge-foreground);
	font-family: var(--font-family);
	font-size: var(--font-size);
	color: var(--color-foreground);
	padding: 0;
}

@include scrollbars.scrollableBase();

a {
	text-decoration: none;
	&:hover {
		text-decoration: underline;
	}
}

ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.bulleted {
	list-style: disc;
	padding-left: 1.2em;
	> li + li {
		margin-top: 0.25em;
	}
}

.button--busy {
	&[aria-busy='true'] {
		opacity: 0.5;
	}

	&:not([aria-busy='true']) {
		code-icon {
			display: none;
		}
	}
}

.button-container {
	margin: 1rem auto 0;
	text-align: left;
	max-width: 30rem;
	transition: max-width 0.2s ease-out;
}

@media (min-width: 640px) {
	.button-container {
		max-width: 100%;
	}
}

.button-group {
	display: inline-flex;
	gap: 0.1rem;

	&--single {
		width: 100%;
		max-width: 30rem;
	}

	> *:not(:first-child),
	> *:not(:first-child) gl-button {
		border-top-left-radius: 0;
		border-bottom-left-radius: 0;
	}

	> *:not(:last-child),
	> *:not(:last-child) gl-button {
		border-top-right-radius: 0;
		border-bottom-right-radius: 0;
	}
}

.section {
	padding: 0 var(--gitlens-scrollbar-gutter-width) 1.5rem var(--gitlens-gutter-width);

	> :first-child {
		margin-top: 0;
	}
	> :last-child {
		margin-bottom: 0;
	}
}

.section--empty {
	> :last-child {
		margin-top: 0.5rem;
	}
}

.section--skeleton {
	padding: {
		top: 1px;
		bottom: 1px;
	}
}

.message-block {
	font-size: 1.3rem;
	border: 1px solid var(--vscode-input-border);
	background: var(--vscode-input-background);
	padding: 0.5rem;
	border-radius: 2px;

	&__text {
		margin: 0;

		overflow-y: auto;
		overflow-x: hidden;
		max-height: 9rem;

		> * {
			white-space: break-spaces;
		}

		strong {
			font-weight: 600;
			font-size: 1.4rem;
		}
	}
}
.message-block-row,
.message-block-group {
	display: flex;
	flex-direction: row;
	gap: 0.6rem;
}

.message-block-row {
	justify-content: space-between;
}

.message-block-row--actions {
	font-size: 1.3rem;
	color: var(--color-foreground--50);
	background: var(--color-background--level-075);
	border-radius: 0 0 0.2rem 0.2rem;
	padding-inline-end: 0.2rem;

	gl-action-chip::part(icon),
	gl-autolink-chip::part(icon),
	gl-commit-date {
		--code-icon-size: 1.3rem;
	}
}

.mq-hide-sm,
gl-autolink-chip::part(label) {
	@media (max-width: 300px) {
		display: none !important;
	}
}

.commit-detail-panel {
	max-height: 100vh;
	overflow: auto;
	scrollbar-gutter: stable;
	color: var(--vscode-sideBar-foreground);
	background-color: var(--vscode-sideBar-background);

	[aria-hidden='true'] {
		display: none;
	}
}

.ai-content {
	font-size: 1.3rem;
	border: 0.1rem solid var(--vscode-input-border, transparent);
	background: var(--vscode-input-background);
	margin-top: 1rem;
	padding: 0.5rem;
	border-radius: 2px;

	&.has-error {
		border-left-color: var(--color-alert-errorBorder);
		border-left-width: 0.3rem;
		padding-left: 0.8rem;
	}

	&:empty {
		display: none;
	}

	&__summary {
		display: block;
		margin: 0;
		overflow-y: auto;
		overflow-x: hidden;
		max-height: 20rem;
	}
}
